﻿Public Module ActiveXCleanup

    Public Sub CleanupNamespaces(ByVal ax As ActiveXControlData)

        If ax.ControlNamespace.EndsWith("Ctl") Then
            ax.ControlNamespace = ax.ControlNamespace.Substring(0, ax.ControlNamespace.Length - 3)
        End If
        If ax.ControlAssembly.EndsWith("Ctl") Then
            ax.ControlAssembly = ax.ControlAssembly.Substring(0, ax.ControlAssembly.Length - 3)
        End If

    End Sub

    Public Sub CleanupProperties(ByVal ControlType As String, ByVal PropertyName As String, ByRef Name As String, ByRef Value As String, ByVal ResourceList As Dictionary(Of String, ResourceData), ByVal ElementInfo As Dictionary(Of String, String))

        Dim NameUpper As String
        Dim ResourceFileName As String
        Dim ResourceLocation As String
        Dim res As ResourceData

        NameUpper = Name.ToUpper
        If PropertyName = "HDRFONT" Then
            If NameUpper = "CHARSET" Then
                Value = Nothing
            ElseIf NameUpper = "WEIGHT" Then
                If Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture) > 0 Then
                    Name = "HdrFontBold"
                    Value = "True"
                Else
                    Value = Nothing
                End If
            ElseIf NameUpper = "STRIKETHROUGH" Then
                Name = "HdrFontStrikethru"
                Value = ConvertBoolean(Value)
            Else
                Name = "HdrFont" & Name
                If NameUpper = "UNDERLINE" OrElse NameUpper = "ITALIC" Then
                    Value = ConvertBoolean(Value)
                End If
            End If
        ElseIf PropertyName = "FONT" Then
            If NameUpper = "CHARSET" Then
                Value = Nothing
            ElseIf NameUpper = "WEIGHT" Then
                If Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture) > 0 Then
                    Name = "FontBold"
                    Value = "True"
                Else
                    Value = Nothing
                End If
            ElseIf NameUpper = "STRIKETHROUGH" Then
                Name = "FontStrikethru"
                Value = ConvertBoolean(Value)
            Else
                Name = "Font" & Name
                If NameUpper = "UNDERLINE" OrElse NameUpper = "ITALIC" Then
                    Value = ConvertBoolean(Value)
                End If
            End If
        ElseIf (NameUpper = "_CX" OrElse NameUpper = "_CY") Then
            Value = Nothing
        ElseIf (NameUpper = "_EXTENTX" OrElse NameUpper = "_EXTENTY") Then
            Value = Nothing
        ElseIf NameUpper = "_VERSION" Then
            Value = Nothing
        ElseIf NameUpper = "ABORTWINDOW" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "ABORTWINDOWPOS" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "awAppWindow"
                Case 1
                    Value = "awScreenCenter"
            End Select
        ElseIf NameUpper = "ALIGN" Then
            Value = Nothing
        ElseIf NameUpper = "ALIGNLEFT" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "ALLOWBIGSELECTION" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "ALLOWSELECTION" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "ALLOWUSERRESIZING" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 3
                    Value = "flexResizeBoth"
                Case 4
                    Value = "flexResizeBothUniform"
                Case 1
                    Value = "flexResizeColumns"
                Case 0
                    Value = "flexResizeNone"
                Case 2
                    Value = "flexResizeRows"
            End Select
        ElseIf NameUpper = "ALLOWUSERFREEZING" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 3
                    Value = "flexFreezeBoth"
                Case 1
                    Value = "flexFreezeColumns"
                Case 0
                    Value = "flexFreezeNone"
                Case 2
                    Value = "flexFreezeRows"
            End Select
        ElseIf NameUpper = "APPEARANCE" AndAlso ControlType = "MSCOMCTL2.MONTHVIEW" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "cc23D"
                Case 0
                    Value = "cc2Flat"
            End Select
        ElseIf NameUpper = "APPEARANCE" AndAlso ControlType = "VSDRAW7LIBCTL.VSDRAW" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "apFlat"
                Case 1
                    Value = "ap3D"
            End Select
        ElseIf NameUpper = "APPEARANCE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexFlat"
                Case 1
                    Value = "flex3D"
                Case 2
                    Value = "flex3DLight"
            End Select
        ElseIf NameUpper = "APPEARANCE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "apFlat"
                Case 1
                    Value = "ap3D"
                Case 2
                    Value = "ap3DLight"
            End Select
        ElseIf NameUpper = "AUTOARRANGE" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "AUTORESIZE" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "AUTORTF" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "AUTOSCROLL" AndAlso ControlType = "VSVIEWPORT7LIBCTL.VSVIEWPORT" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "AUTOSEARCH" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexSearchNone"
                Case 1
                    Value = "flexSearchFromTop"
                Case 2
                    Value = "flexSearchFromCursor"
            End Select
        ElseIf NameUpper = "AUTOSIZEMODE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexAutoSizeColWidth"
                Case 1
                    Value = "flexAutoSizeRowHeight"
            End Select
        ElseIf NameUpper = "AUTOSIZEMOUSE" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "BACKCOLOR" Then
            Value = ConvertColor(Value)
        ElseIf NameUpper = "BORDERSTYLE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "bsNone"
                Case 1
                    Value = "bsSingle"
            End Select
        ElseIf NameUpper = "BORDERSTYLE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexBorderNone"
                Case 1
                    Value = "flexBorderFlat"
            End Select
        ElseIf NameUpper = "BRUSHSTYLE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 6
                    Value = "bsCross"
                Case 7
                    Value = "bsDiagonalCross"
                Case 5
                    Value = "bsDiagonalDown"
                Case 4
                    Value = "bsDiagonalUp"
                Case 2
                    Value = "bsHorzLine"
                Case 0
                    Value = "bsSolid"
                Case 1
                    Value = "bsTransparent"
                Case 3
                    Value = "bsVertLine"
            End Select
        ElseIf NameUpper = "CANCELERROR" AndAlso ControlType = "MSCOMDLG.COMMONDIALOG" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "CENTER" AndAlso ControlType = "MSCOMCTL2.ANIMATION" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "COMBOSEARCH" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 3
                    Value = "flexCmbSearchAll"
                Case 2
                    Value = "flexCmbSearchCombos"
                Case 1
                    Value = "flexCmbSearchLists"
                Case 0
                    Value = "flexCmbSearchNone"
            End Select
        ElseIf NameUpper = "CURRENTDATE" _
        AndAlso (ControlType = "MSCOMCTL2.DTPICKER" _
        OrElse ControlType = "MSCOMCTL2.MONTHVIEW") Then
            Value = Nothing
        ElseIf NameUpper = "DEFAULTDEVICE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "EDITABLE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "flexEDKbd"
                Case 2
                    Value = "flexEDKbdMouse"
                Case 0
                    Value = "flexEDNone"
            End Select
        ElseIf NameUpper = "ELLIPSIS" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "flexEllipsisEnd"
                Case 2
                    Value = "flexEllipsisPath"
                Case 0
                    Value = "flexNoEllipsis"
            End Select
        ElseIf NameUpper = "ENABLED" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "EXPLORERBAR" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 2
                    Value = "flexExMove"
                Case 8
                    Value = "flexExMoveRows"
                Case 0
                    Value = "flexExNone"
                Case 1
                    Value = "flexExSort"
                Case 3
                    Value = "flexExSortAndMove"
                Case 5
                    Value = "flexExSortShow"
                Case 7
                    Value = "flexExSortShowAndMove"
            End Select
        ElseIf NameUpper = "EXPORTFORMAT" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "vpxDHTML"
                Case 3
                    Value = "vpxPagedDHTML"
                Case 2
                    Value = "vpxPagedHTML"
                Case 0
                    Value = "vpxPlainHTML"
                Case 4
                    Value = "vpxRTF"
            End Select
        ElseIf NameUpper = "EXTENDLASTCOL" Then
            Value = ConvertBoolean(Value)
        ElseIf (NameUpper = "EXTENTX" OrElse NameUpper = "EXTENTY") AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "FILLSTYLE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexFillSingle"
                Case 1
                    Value = "flexFillRepeat"
            End Select
        ElseIf NameUpper = "FOCUSRECT" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 2
                    Value = "flexFocusHeavy"
                Case 5
                    Value = "flexFocusInset"
                Case 1
                    Value = "flexFocusLight"
                Case 0
                    Value = "flexFocusNone"
                Case 4
                    Value = "flexFocusRaised"
                Case 3
                    Value = "flexFocusSolid"
            End Select
        ElseIf NameUpper = "FOCUSTRACK" AndAlso ControlType = "VSVIEWPORT7LIBCTL.VSVIEWPORT" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "FORECOLOR" Then
            Value = ConvertColor(Value)
        ElseIf NameUpper = "FORMAT" AndAlso ControlType = "MSCOMCTL2.DTPICKER" Then
            Value = Nothing
        ElseIf (NameUpper = "FULLWIDTH" OrElse NameUpper = "FULLHEIGHT") _
        AndAlso ControlType = "MSCOMCTL2.ANIMATION" Then
            Value = Nothing
        ElseIf (NameUpper = "GRIDLINES" OrElse NameUpper = "GRIDLINESFIXED") AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 13
                    Value = "flexGridExcel"
                Case 12
                    Value = "flexGridExplorer"
                Case 1
                    Value = "flexGridFlat"
                Case 4
                    Value = "flexGridFlatHorz"
                Case 8
                    Value = "flexGridFlatVert"
                Case 2
                    Value = "flexGridInset"
                Case 5
                    Value = "flexGridInsetHorz"
                Case 9
                    Value = "flexGridInsetVert"
                Case 0
                    Value = "flexGridNone"
                Case 3
                    Value = "flexGridRaised"
                Case 6
                    Value = "flexGridRaisedHorz"
                Case 10
                    Value = "flexGridRaisedVert"
                Case 7
                    Value = "flexGridSkipHorz"
                Case 11
                    Value = "flexGridSkipVert"
            End Select
        ElseIf NameUpper = "HEIGHT" Then
            ElementInfo.Add("Height", Value)
            Value = Nothing
        ElseIf NameUpper = "HIDEFILENAMES" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "HIGHLIGHT" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "flexHighlightAlways"
                Case 0
                    Value = "flexHighlightNever"
                Case 2
                    Value = "flexHighlightWithFocus"
            End Select
        ElseIf NameUpper = "HORIZONTAL" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "KEEPTEXTASPECT" AndAlso ControlType = "VSDRAW7LIBCTL.VSDRAW" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "KEY" Then
            'ElementInfo.Add("Key", Value)
            Value = Nothing
        ElseIf NameUpper = "LEFT" Then
            ElementInfo.Add("Left", Value)
            Value = Nothing
        ElseIf NameUpper = "LOCATION" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "MERGECELLS" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 5
                    Value = "flexMergeFixedOnly"
                Case 1
                    Value = "flexMergeFree"
                Case 0
                    Value = "flexMergeNever"
                Case 7
                    Value = "flexMergeOutline"
                Case 4
                    Value = "flexMergeRestrictAll"
                Case 3
                    Value = "flexMergeRestrictColumns"
                Case 2
                    Value = "flexMergeRestrictRows"
                Case 6
                    Value = "flexMergeSpill"
            End Select
        ElseIf NameUpper = "MERGECOMPARE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexMCExact"
                Case 1
                    Value = "flexMCNoCase"
                Case 2
                    Value = "flexMCTrimNoCase"
            End Select
        ElseIf NameUpper = "MOUSESCROLL" AndAlso ControlType = "VSDRAW7LIBCTL.VSDRAW" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "MOUSESCROLL" AndAlso ControlType = "VSVIEWPORT7LIBCTL.VSVIEWPORT" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "MOUSEPOINTER" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "flexArrow"
                Case 13
                    Value = "flexArrowHourGlass"
                Case 14
                    Value = "flexArrowQuestion"
                Case 2
                    Value = "flexCross"
                Case 99
                    Value = "flexCustom"
                Case 0
                    Value = "flexDefault"
                Case 54
                    Value = "flexHand"
                Case 11
                    Value = "flexHourglass"
                Case 3
                    Value = "flexIBeam"
                Case 4
                    Value = "flexIcon"
                Case 12
                    Value = "flexNoDrop"
                Case 50
                    Value = "flexPointerCopy"
                Case 51
                    Value = "flexPointerMove"
                Case 5
                    Value = "flexSize"
                Case 16
                    Value = "flexSizeAll"
                Case 9
                    Value = "flexSizeEW"
                Case 52
                    Value = "flexSizeHorz"
                Case 6
                    Value = "flexSizeNESW"
                Case 7
                    Value = "flexSizeNS"
                Case 8
                    Value = "flexSizeNWSE"
                Case 53
                    Value = "flexSizeVert"
                Case 10
                    Value = "flexUpArrow"
            End Select
        ElseIf NameUpper = "MOUSEPOINTER" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "mpArrow"
                Case 13
                    Value = "mpArrowHourGlass"
                Case 14
                    Value = "mpArrowQuestion"
                Case 2
                    Value = "mpCross"
                Case 99
                    Value = "mpCustom"
                Case 0
                    Value = "mpDefault"
                Case 11
                    Value = "mpHourglass"
                Case 3
                    Value = "mpIBeam"
                Case 4
                    Value = "mpIcon"
                Case 12
                    Value = "mpNoDrop"
                Case 50
                    Value = "mpHandPoint"
                Case 51
                    Value = "mpHandDrag"
                Case 5
                    Value = "mpSize"
                Case 9
                    Value = "mpSizeEW"
                Case 52
                    Value = "mpPage"
                Case 6
                    Value = "mpSizeNESW"
                Case 7
                    Value = "mpSizeNS"
                Case 8
                    Value = "mpSizeNWSE"
                Case 53
                    Value = "mpZoom"
                Case 10
                    Value = "mpUpArrow"
                Case 15
                    Value = "mpSizeAll"
            End Select
        ElseIf NameUpper = "MULTITOTALS" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "NAVBAR" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 2
                    Value = "vpnbBottom"
                Case 4
                    Value = "vpnbBottomPrint"
                Case 0
                    Value = "vpnbNone"
                Case 1
                    Value = "vpnbTop"
                Case 3
                    Value = "vpnbTopPrint"
            End Select
        ElseIf NameUpper = "NAVIGATION" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 7
                    Value = "vpnvAll"
                Case 4
                    Value = "vpnvKeyboard"
                Case 1
                    Value = "vpnvMouse"
                Case 5
                    Value = "vpnvMouseKeyboard"
                Case 3
                    Value = "vpnvMouseWheel"
                Case 0
                    Value = "vpnvNone"
                Case 2
                    Value = "vpnvWheel"
                Case 6
                    Value = "vpnvWheelKeyboard"
            End Select
        ElseIf NameUpper = "NOCLIENTEDGE" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "NOWEBVIEW" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "NOFOLDERS" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "OFFLINE" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "OLEDRAGMODE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Name = "OLEDragMode"
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexOLEDragManual"
                Case 1
                    Value = "flexOLEDragAutomatic"
            End Select
        ElseIf NameUpper = "OLEDRAGMODE" AndAlso ControlType = "VSFLEX7UCTL.VSFLEXGRID" Then
            Value = Nothing
        ElseIf NameUpper = "OLEDROPMODE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Name = "OLEDropMode"
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexOLEDropNone"
                Case 1
                    Value = "flexOLEDropManual"
                Case 2
                    Value = "flexOLEDropAutomatic"
            End Select
        ElseIf NameUpper = "OLEDROPMODE" AndAlso ControlType = "VSFLEX7UCTL.VSFLEXGRID" Then
            Value = Nothing
        ElseIf NameUpper = "OLEOBJECTBLOB" Then
            Value = Nothing
        ElseIf NameUpper = "OUTLINEBAR" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "flexOutlineBarComplete"
                Case 4
                    Value = "flexOutlineBarCompleteLeaf"
                Case 0
                    Value = "flexOutlineBarNone"
                Case 2
                    Value = "flexOutlineBarSimple"
                Case 5
                    Value = "flexOutlineBarSimpleLeaf"
                Case 3
                    Value = "flexOutlineBarSymbols"
                Case 6
                    Value = "flexOutlineBarSymbolsLeaf"
            End Select
        ElseIf NameUpper = "OWNERDRAW" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 3
                    Value = "flexODComplete"
                Case 6
                    Value = "flexODCompleteFixed"
                Case 2
                    Value = "flexODContent"
                Case 5
                    Value = "flexODContentFixed"
                Case 0
                    Value = "flexODNone"
                Case 1
                    Value = "flexODOver"
                Case 4
                    Value = "flexODOverFixed"
            End Select
        ElseIf NameUpper = "PAGEBORDER" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 7
                    Value = "pbAll"
                Case 1
                    Value = "pbBottom"
                Case 4
                    Value = "pbBox"
                Case 9
                    Value = "pbColBottom"
                Case 8
                    Value = "pbColTop"
                Case 6
                    Value = "pbColTopBottom"
                Case 5
                    Value = "pbColumns"
                Case 0
                    Value = "pbNone"
                Case 2
                    Value = "pbTop"
                Case 3
                    Value = "pbTopBottom"
            End Select
        ElseIf NameUpper = "PENSTYLE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 1
                    Value = "psDash"
                Case 3
                    Value = "psDashDot"
                Case 4
                    Value = "psDashDotDot"
                Case 2
                    Value = "psDot"
                Case 6
                    Value = "psInsideSolid"
                Case 0
                    Value = "psSolid"
                Case 5
                    Value = "psTransparent"
            End Select
        ElseIf NameUpper = "PHYSICALPAGE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "PICTURE" AndAlso ControlType.StartsWith("LISTIMAGE") AndAlso Integer.TryParse(ControlType.Substring(9), Nothing) Then
            ResourceFileName = Value.Substring(0, Value.LastIndexOf(":") - 1).Trim.Replace("""", "")
            ResourceFileName = IO.Path.GetFileNameWithoutExtension(ResourceFileName)
            ResourceLocation = Value.Substring(Value.LastIndexOf(":") + 1)
            res = New ResourceData
            res.Type = "Image"
            res.ElementInfo = ElementInfo
            ResourceList.Add(ResourceLocation, res)
            Value = Nothing '"{StaticResource " & ResourceFileName & "ResourceAt" & ResourceLocation & "}"
        ElseIf NameUpper = "PICTURESOVER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "PICTURETYPE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexPictureColor"
                Case 1
                    Value = "flexPictureMonochrome"
            End Select
        ElseIf NameUpper = "PREVIEW" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "PROPORTIONALBARS" AndAlso ControlType = "VSDRAW7LIBCTL.VSDRAW" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "PROPORTIONALBARS" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "PROPORTIONALBARS" AndAlso ControlType = "VSVIEWPORT7LIBCTL.VSVIEWPORT" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "REGISTERASBROWSER" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "REGISTERASDROPTARGET" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "RIGHTTOLEFT" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "SCROLLBARS" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 3
                    Value = "flexScrollBarBoth"
                Case 1
                    Value = "flexScrollBarHorizontal"
                Case 0
                    Value = "flexScrollBarNone"
                Case 2
                    Value = "flexScrollBarVertical"
            End Select
        ElseIf NameUpper = "SCROLLTRACK" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "SCROLLTIPS" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "SELECTIONMODE" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 2
                    Value = "flexSelectionByColumn"
                Case 1
                    Value = "flexSelectionByRow"
                Case 0
                    Value = "flexSelectionFree"
                Case 3
                    Value = "flexSelectionListBox"
            End Select
        ElseIf NameUpper = "SHOWGUIDES" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 2
                    Value = "gdDesignTime"
                Case 0
                    Value = "gdHide"
                Case 1
                    Value = "gdShow"
            End Select
        ElseIf NameUpper = "SILENT" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "SINGLECLICK" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "SINGLESELECTION" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "STARTOFWEEK" AndAlso ControlType = "MSCOMCTL2.MONTHVIEW" Then
            Value = Nothing
        ElseIf NameUpper = "SHOWCOMBOBUTTON" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "SUBTOTALPOSITION" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexSTBelow"
                Case 1
                    Value = "flexSTAbove"
            End Select
        ElseIf NameUpper = "TABBEHAVIOR" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexTabControls"
                Case 1
                    Value = "flexTabCells"
            End Select
        ElseIf NameUpper = "TABLEBORDER" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 7
                    Value = "tbAll"
                Case 10
                    Value = "tbBelowHeader"
                Case 1
                    Value = "tbBottom"
                Case 4
                    Value = "tbBox"
                Case 9
                    Value = "tbBoxColumns"
                Case 8
                    Value = "tbBoxRows"
                Case 6
                    Value = "tbColTopBottom"
                Case 5
                    Value = "tbColumns"
                Case 0
                    Value = "tbNone"
                Case 5
                    Value = "tbRows"
                Case 2
                    Value = "tbTop"
                Case 3
                    Value = "tbTopBottom"
            End Select
        ElseIf NameUpper = "TABSTOP" Then
            Value = ConvertBoolean(Value)
        ElseIf (NameUpper = "TEXTSTYLE" OrElse NameUpper = "TEXTSTYLEFIXED") AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 0
                    Value = "flexTextFlat"
                Case 2
                    Value = "flexTextInset"
                Case 4
                    Value = "flexTextInsetLight"
                Case 1
                    Value = "flexTextRaised"
                Case 3
                    Value = "flexTextRaisedLight"
            End Select

        ElseIf NameUpper = "TOP" Then
            ElementInfo.Add("Top", Value)
            Value = Nothing
        ElseIf NameUpper = "TRACK" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "TRACK" AndAlso ControlType = "VSVIEWPORT7LIBCTL.VSVIEWPORT" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "TRACK" AndAlso ControlType = "VSDRAW7LIBCTL.VSDRAW" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "TRANSPARENT" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "VIEWID" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "VIEWMODE" AndAlso ControlType = "SHDOCVWCTL.WEBBROWSER" Then
            Value = Nothing
        ElseIf NameUpper = "VIRTUALDATA" AndAlso ControlType = "VSFLEX7UCTL.VSFLEXGRID" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "VISIBLE" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "WALLPAPERALIGNMENT" AndAlso ControlType = "VSFLEX7LCTL.VSFLEXGRID" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 5
                    Value = "flexPicAlignCenterBottom"
                Case 4
                    Value = "flexPicAlignCenterCenter"
                Case 3
                    Value = "flexPicAlignCenterTop"
                Case 2
                    Value = "flexPicAlignLeftBottom"
                Case 1
                    Value = "flexPicAlignLeftCenter"
                Case 0
                    Value = "flexPicAlignLeftTop"
                Case 8
                    Value = "flexPicAlignRightBottom"
                Case 7
                    Value = "flexPicAlignRightCenter"
                Case 6
                    Value = "flexPicAlignRightTop"
                Case 9
                    Value = "flexPicAlignStretch"
                Case 10
                    Value = "flexPicAlignTile"
            End Select
        ElseIf NameUpper = "WALLPAPER" Then
            ResourceFileName = Value.Substring(0, Value.LastIndexOf(":") - 1).Trim.Replace("""", "")
            ResourceFileName = IO.Path.GetFileNameWithoutExtension(ResourceFileName)
            ResourceLocation = Value.Substring(Value.LastIndexOf(":") + 1)
            res = New ResourceData
            res.Type = "Image"
            res.ElementInfo = ElementInfo
            ResourceList.Add(ResourceLocation, res)
            Value = Nothing '"{StaticResource " & ResourceFileName & "ResourceAt" & ResourceLocation & "}"
        ElseIf NameUpper = "WIDTH" Then
            ElementInfo.Add("Width", Value)
            Value = Nothing
        ElseIf NameUpper = "WORDWRAP" Then
            Value = ConvertBoolean(Value)
        ElseIf NameUpper = "ZOOMMODE" AndAlso ControlType = "VSPRINTER7LIBCTL.VSPRINTER" Then
            Select Case Convert.ToInt32(Value, Globalization.CultureInfo.InvariantCulture)
                Case 4
                    Value = "zmPageWidth"
                Case 0
                    Value = "zmPercentage"
                Case 5
                    Value = "zmStretch"
                Case 1
                    Value = "zmThumbnail"
                Case 2
                    Value = "zmTwoPages"
                Case 3
                    Value = "zmWholePage"
            End Select
        End If

    End Sub

End Module
